<input type=submit> buttons are used to submit forms. If you want to create a custom button and then customize the behavior using JavaScript, you need to use ...
If you want to validate the form before submitting, the best event handler would be the onsubmit event of the form. Example: HTML; CSS; JS. Result; Skip ...
DOCTYPE html> <html> <body> <p>Enter names in the fields, then click Submit to submit the form:</p> <form id=frm1 action=/action_page.php>
The onclick event occurs when the user clicks on an HTML element. Mouse Events See Also: The Mouse Event Object Tutorial: JavaScript Events HTML DOM Events · Oncontextmenu Event · Onchange Event · Ondblclick Event